package LFhalf {
	import flash.display.BitmapData;
	import flash.display.DisplayObjectContainer;
	import flash.display.MovieClip;
	import flash.display.Bitmap;
	import flash.display.Stage;
	import flash.geom.Rectangle;
	class Render {
		static private var share:Render;
		static public function get instance():Render {
			if (share == null) {
				share = new Render();
			}
			return share;
		}
		
		public var stageWidth:uint = 960;
		public var stageHeight:uint = 600;
		public var stagefps:Number = 30;
		
		private var MCgame:MovieClip;
		private var MainGameBMD:BitmapData;
		private var MainGameBMP:Bitmap;
		private var mainStage:DisplayObjectContainer;
		public function Render() {
			MCgame = new MovieClip();
			MainGameBMD = new BitmapData(stageWidth, stageHeight, true, 0);
			MainGameBMP = new Bitmap(MainGameBMD, "auto", true);
			MCgame.addChild(MainGameBMP);
		}
		
		public function init(_stage:DisplayObjectContainer) {
			mainStage=_stage;
			mainStage.addChild(MCgame);
		}
		
		public function doRender():void 
		{
			//clear MainGameBMD
			MainGameBMD.fillRect(new Rectangle(0, 0, stageWidth, stageHeight),0);
			//set width,height after scale
			
			//foreach obj
			for (var i:String in Game.instance.objectList) {
				//check and draw,effect
				//draw sprite effect
				draw(objectList[i]);
			}
			//scale full bmp
			
			//make/move bg,fg
			//specail effect
			//set UI
		}
		
		private function draw(obj:phyObject):void {
			//get rect,point
			//scale flip rotate
			//MainGameBMD.copyPixels(b, r, p, null, null, true);
		}
	}
}